package top.haichi.webpaper.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import top.haichi.webpaper.entity.Teacher;
import top.haichi.webpaper.entity.Teacher;

@Mapper
public interface TeacherMapper extends BaseMapper<Teacher> {

    /**
     * id查询老师存在
     * @param teacher
     * @return
     */
    @Select("Select id from teacher where id = #{id}")
    public Teacher getIdById(Teacher teacher);

    /**
     * id查询老师
     * @param teacher
     * @return
     */
    @Select("select id,name,class_name,gender,email from teacher where id = #{id}")
    public Teacher getTeacherByid(Teacher teacher);

    /**
     * 新增老师
     * @param teacher
     */
    @Insert("insert into teacher(id,name,class_name,gender,email) values (#{id},#{name},#{className},#{gender},#{email})")
    public void addTeacher(Teacher teacher);

    /**
     * 上传头像后把has_portrait改为true
     * @param teacher
     */
    @Update("update teacher set has_portrait = true where id = #{id}")
    public void updatePortrait(Teacher teacher);

    public void updateTeacherInformation(Teacher teacher);

}
